package com.canaan.business.common.helper;

import com.canaan.business.domain.basic.WmsStorehouseLocation;
import com.canaan.business.service.basic.IWmsStorehouseLocationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Component
public class WmsStoreHouseLocationHelper {
    @Autowired
    private IWmsStorehouseLocationService storehouseLocationService;
    /**
     * 库位字典
     */
    private Map<String, WmsStorehouseLocation> locationMap=new HashMap<>();
    @PostConstruct
    public void Init(){
        WmsStorehouseLocation query=new WmsStorehouseLocation();
        query.setDelFlag("0");
        List<WmsStorehouseLocation> locationList=storehouseLocationService.selectWmsStorehouseLocationList(query);
        for(WmsStorehouseLocation item:locationList){
            locationMap.put(item.getNo(),item);
        }
    }

    /**
     * 获取库位
     */
    public WmsStorehouseLocation getLocationByNo(String locationNo){
        return storehouseLocationService.selectWmsStorehouseLocationByNo(locationNo);
    }
}
